package com.starbugs.wehcat.pojo;


import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @author starbooks
 */
public class MyBeanPostProcessor implements BeanPostProcessor {

  @Override
  public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    Class beanClass = bean.getClass();
    if (beanClass == HelloWorld.class) {
      System.out.println("HelloWorld bean 对象初始化之前······");
    }
    return bean;
  }

  @Override
  public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
    System.out.println("HelloWorld bean 对象初始化之后······");
    return bean;
  }
}